Skip to content

Conversation

bdrung
Copy link

@bdrung bdrung commented Mar 5, 2025

Description

The feature or problem addressed by this PR

The utcnow function has been deprecated starting from Python 3.12: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

What your changes do and why you chose this solution

Thus replace datetime.datetime.utcnow() by datetime.datetime.now(datetime.timezone.utc). Also replace pytz with standard Python.

Fixes: #934

Checklist

  • Checked that no other issues or pull requests exist for the same issue/change
  • Added tests covering the new functionality
  • Updated documentation OR the change is too minor to be documented
  • Updated CHANGELOG.md OR changes are insignificant

The `utcnow` function has been deprecated starting from Python 3.12:
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Thus replace `datetime.datetime.utcnow()` by
`datetime.datetime.now(datetime.timezone.utc)`. Also replace `pytz` with
standard Python.

Fixes: IdentityPython#934
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pysaml2 raises DeprecationWarning: datetime.datetime.utcnow() when running tests with pytests on python 3.12
1 participant